#ifndef log_warper_h__
#define log_warper_h__

#pragma once
#include <string>
#include <sstream>
#include <iomanip>

namespace loging
{
class	loger;

enum	loging_level{
	ll_debug,
	ll_info,
	ll_warning,
	ll_error,
	ll_fatal_err,
	ll_end_palce_
};
class log_warper
{
public:
	log_warper();
	explicit	log_warper(loging_level log_lvl);
	log_warper(loging_level log_lvl,const std::string& source_file,const std::string& func_name,int line_number,int error_code);
	log_warper(loging_level log_lvl,const std::string& source_file,const std::string& func_name,int line_number,bool abort);
	log_warper&		reset(loging_level log_lvl,const std::string& source_file="",const std::string& func_name="",int line_number=-1);
	std::ostream&	stream();
	void		finish();
	loger&		get_impl();
	~log_warper(void);
private:
	log_warper(const log_warper&);
	log_warper&	operator=(const log_warper&);
private:
	loger*		impl_;
};

};//loging

#define		debug_loger					(log_warper(ll_debug,__FILE__,__FUNCTION__,__LINE__))
#define		debug_err_loger(error_code)	(log_warper(ll_debug,__FILE__,__FUNCTION__,__LINE__,(error_code)))
#define		info_loger					(log_warper(ll_info))
#define		warn_loger					(log_warper(ll_warning))
#define		err_loger					(log_warper(ll_error,__FILE__,__FUNCTION__,__LINE__))
#define		fata_loger					(log_warper(ll_fatal_err,__FILE__,__FUNCTION__,__LINE__,true))
#endif // log_warper_h__
